home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
littlest
/
littl-st.lha
/
st.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-10
|
2KB
|
114 lines
/*
Little Smalltalk, version 3
Main Driver
written By Tim Budd, September 1988
Oregon State University
*/
# include <stdio.h>
# include "env.h"
# include "memory.h"
# include "names.h"
# ifdef STDWIN
# ifdef LIGHTC
# undef NOARGC /* get arguments from stdwin's winitnew */
extern char *about_item, *about_message;
# endif
# endif
int initial = 0; /* not making initial image */
extern int objectCount();
# ifdef NOARGC
main()
# endif
# ifndef NOARGC
main(argc, argv)
int argc;
char **argv;
# endif
{
FILE *fp;
object firstProcess;
char *p, buffer[120];
initMemoryManager();
# ifdef BSD42
p = getenv("ST_LIBRARY");
if (p) {
strcpy(buffer,p);
strcat(buffer,"/");
strcat(buffer,"systemImage");
} else
strcpy(buffer,"systemImage");
# endif
# ifndef BSD42
strcpy(buffer,"systemImage");
# endif
p = buffer;
# ifdef STDWIN
/* initialize the standard windows package */
# ifdef LIGHTC
/* change text displayed in mac stdwin's about box */
about_item = "About Little Smalltalk ...";
about_message = "\rLittle Smalltalk, Version 3.05\r\r\
Written by Tim Budd\rOregon State University\r\r\r";
# endif
winitnew(&argc, &argv);
# undef NOARGC
wmenusetdeflocal(1);
# ifdef LIGHTC
if (argc = 1)
if (! waskync("use default initial object image?", 1))
waskfile("image file name", buffer, 120, 0);
# endif
# endif
# ifndef NOARGC
if (argc > 1) p = argv[1];
# endif
# ifdef BINREADWRITE
fp = fopen(p, "rb");
# endif
# ifndef BINREADWRITE
fp = fopen(p, "r");
# endif
if (fp == NULL) {
sysError("cannot open image", p);
exit(1);
}
imageRead(fp);
fclose(fp);
initCommonSymbols();
firstProcess = globalSymbol("systemProcess");
if (firstProcess == nilobj) {
sysError("no initial process","in image");
exit(1); return 1;
}
/* execute the main system process loop repeatedly */
/*debugging = true;*/
# ifndef STDWIN
/* not using windowing interface, safe to print out message */
printf("Little Smalltalk, Version 3.05\n");
printf("Written by Tim Budd, Oregon State University\n");
# endif
while (execute(firstProcess, 15000)) ;
# ifdef STDWIN
wdone();
# endif
/* exit and return - belt and suspenders, but it keeps lint happy */
exit(0); return 0;
}